//
//  SAUser.m
//  Saas
//
//  Created by 杨荣 on 2020/4/14.
//  Copyright © 2020 bing. All rights reserved.
//

#import "SAUser.h"
#import "SAUserInfoTool.h"

@implementation SAUser

static SAUser *user;
+ (SAUser *)shareInstance
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        user = [[SAUser alloc] init];
//        [user initData];
    });
    return user;
}

- (void)initData {
//    self.userId = @"001";
//    self.userName = @"程序猿小锅锅呀";
//    self.positionName = @"总经理";
//    self.storeName = @"衣点通";
//    self.mobile = @"13113654186";
    
    
//    SAUserInfo *userInfo = [SAUserInfoTool getModel];
//
//    self.userId = @"001";
//    self.userName = userInfo.userName;
//    if (userInfo.userType == 1) {// 1-商户
//        self.positionName = @"总经理";
//    }else if (userInfo.userType == 2) {//  2-店长
//        self.positionName = @"店长";
//    }else if (userInfo.userType == 3) {// 3-员工
//        self.positionName = @"员工";
//    }
//    self.storeName = userInfo.storeName;
//    self.mobile = userInfo.mobile;
    
    
    
}

- (NSString *)userName {
    SAUserInfo *userInfo = [SAUserInfoTool getModel];
    return userInfo.userName;
}
- (NSString *)positionName {
    SAUserInfo *userInfo = [SAUserInfoTool getModel];
    if (userInfo.userType == 1) {// 1-商户
        return @"总经理";
    }else if (userInfo.userType == 2) {//  2-店长
         return @"店长";
    }else if (userInfo.userType == 3) {// 3-员工
         return @"员工";
    }else {
        return @"用户";
    }
//     return userInfo.empName;
}
- (NSString *)storeName {
    SAUserInfo *userInfo = [SAUserInfoTool getModel];
    return userInfo.storeName;
}
- (NSString *)mobile {
    SAUserInfo *userInfo = [SAUserInfoTool getModel];
    return userInfo.mobile;
}
@end
